﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageLocations.aspx.cs" CodeFileBaseClass="BaseView" ViewName="ManageLocations"
    Inherits="Administration_ManageLocations" Title="Crux - Manage Locations" %>

<%@ Register Src="../Controls/Common/WaterMarkedTextBox.ascx" TagName="WaterMarkedTextBox"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ErrorNotification.ascx" TagName="ErrorNotification"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ManagedEntityName.ascx" TagName="ManagedEntityName"
    TagPrefix="crux" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="scriptManager" runat="server">
    </asp:ScriptManager>
    <!-- 
        CreativeToDo: The Text Boxes On This Page Don't Change Their BackGround Like Login Page 
             when Validations are not satified 
        -->
    <asp:UpdatePanel ID="updUpdate" runat="server">
        <ContentTemplate>
            <crux:ManagedEntityName PreceedingText="You are currently managing:" ID="lblManagedCompanyName"
                ShowEntityURL="true" EntityType="Company" runat="server" />
            <table><tr><td height="12"></td></tr></table>
            <asp:Panel ID="pnlList" runat="server">
                <table cellpadding="0" cellspacing="0" class="toolbar">
    <tr>
    <td>
                <asp:ImageButton ID="btnAddNewLocation" runat="server" Text="Add Location" OnClick="btnAddNewLocation_Click" ImageUrl="../App_Themes/DefaultTheme/images/add_location.gif"/>
                </td>
                </tr>
                </table>
<table><tr><td height="12"></td></tr></table>
                <asp:GridView ID="grdLocations" runat="server" OnRowDataBound="grdLocations_RowDataBound"
                    AutoGenerateColumns="False">
                    <Columns>
                        <asp:BoundField DataField="LocationID" HeaderText="Location ID" ItemStyle-CssClass="GridFirstColumn" />
                        <asp:BoundField DataField="LocationName" HeaderText="Location Name" />
                        <asp:BoundField DataField="LocationAddress" HeaderText="Location Address" />
                        <asp:BoundField DataField="LocationComments" HeaderText="Location Comments" />
                        <asp:TemplateField HeaderText="Actions" ItemStyle-CssClass="ActionButtons">
                            <ItemTemplate>
                                <center>
                                    <asp:ImageButton ID="btnItemEditIcon" runat="server" CausesValidation="false" CommandName="EditItem"
                                        OnCommand="grdLocations_RowCommand" CommandArgument='<%#Eval("LocationID")%>'
                                        ImageUrl="~/appimages/edit_location_details.gif" ToolTip="Edit Location Details" />
                                    <asp:ImageButton ID="btnItemDelete" runat="server" CausesValidation="false" CommandName="DeleteItem"
                                        OnCommand="grdLocations_RowCommand" CommandArgument='<%#Eval("LocationID")%>'
                                        ImageUrl="~/appImages/delete.gif" ToolTip="Delete" />
                                    <!-- CreativeTodo: Have Icon For 'Manage SubLocations' -->
                                    <asp:ImageButton ID="btnOpenSubLocation" runat="server" CausesValidation="false"
                                        CommandName="OpenView" OnCommand="grdLocations_RowCommand" CommandArgument='<%#Eval("LocationID")%>'
                                        ImageUrl="~/appimages/manage_sublocations.gif" ToolTip="Manage SubLocation" />
                                </center>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:Panel>
            <asp:Panel ID="pnlAddEdit" runat="server">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="formTxtHeader" colspan="2">
                            Location
                        </td>
                        
                    </tr>
                    <tr>
                        <td class="formLine" colspan="2">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <!-- Location ID -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblLocationID" runat="server" Text="Location ID:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <asp:Label ID="lblLocationIDValue" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Location Name -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblLocationName" runat="server" Text="Location Name:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtLocationName" WaterMarkText="Location Name" ValueRequired="true" 
                                ErrorText="Location Name is required." Width="180" MaxLength="50" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Location Address -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblLocationAddress" runat="server" Text="Location Address:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtLocationAddress" WaterMarkText="Location Address"
                                ValueRequired="false" TextMode="MultiLine" ErrorText="Location Address is required."
                                Width="180" Height="30" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Location Comments -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblLocationComments" runat="server" Text="Location Comments:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtLocationComments" WaterMarkText="Location Comments"
                                ValueRequired="false" MaxLength="10" TextMode="MultiLine" Width="180" Height="30"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td align="left">
                            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                            &nbsp;
                            <asp:Button ID="btnCancel" CausesValidation="false" runat="server" Text="Cancel"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <crux:ErrorNotification ID="pnlError" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
